﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using NHibernateSample.Domain.Entities;

namespace NHibernateSample.Data.Test
{
    [TestFixture]
    public class CustomerManageFixture
    {
        private CustomerManage _sample;
        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            _sample = new CustomerManage();
        }
        [Test]
        public void GetCustomerByIdTest()
        {
            var tempCutomer = new Customer { FirstName = "李", LastName = "永京" };
            _sample.CreateCustomer(tempCutomer);
            Customer customer = _sample.GetCustomerById(1);
            int customerId = customer.Id;
            Assert.AreEqual(1, customerId);
        }

        [Test]
        public void GetCustomerOrderes()
        {
            Customer customer = _sample.GetCustomerById(1);
            int ordersCount = customer.Orders.Count;
            Assert.GreaterOrEqual( ordersCount,1);
        }
    }
}
